﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSP.Model.CSP;
using CSP.Model.CSPEnum;
using CSP.Bll.DTO.Order;

namespace CSP.Bll.IObjectBlls
{
    public interface IOrderBll : ICSPBll<Order>
    {
        ICollection<Order> FindByOrderUser(string userName, DateTime startTime, DateTime endTime, int pageIndex, int pageSize, out int pageCount);

        ICollection<Order> FindByServiceUser(string userName, DateTime startTime, DateTime endTime, int pageIndex, int pageSize, out int pageCount);

        int FindCountByServiceInfoOrderNumber(int serviceInfoOrderNumber);

        /// <summary>
        /// 根据serviceInfoId获取OrderNumbers
        /// </summary>
        /// <param name="serviceInfoId"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByServiceInfoId(int serviceInfoId);

        /// <summary>
        /// 根据用户名获取 OrderNumber
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByConsumeUser(string consumeUserName);

        /// <summary>
        /// 根据服务者用户名获取 OrderNumber
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByServiceUser(string serviceUserName);


        /// <summary>
        /// 获取消费用户订单OrderNumber,根据消费者用户名，开始时间结束时间
        /// </summary>
        /// <param name="consumeUserName"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByConsumeUserNameAndStartTimeAndEndTime(string consumeUserName, DateTime startTime, DateTime endTime);

        /// <summary>
        /// 获取服务用户订单OrderNumber,根据服务者用户名，开始时间结束时间
        /// </summary>
        /// <param name="serviceUserName"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByServiceUserNameAndStartTimeAndEndTime(string serviceUserName, DateTime startTime, DateTime endTime);

        /// <summary>
        /// 根据OrderNumber 和consumeUserName(消费用户名) 获取数据订单数据
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="orderUserName"></param>
        /// <returns></returns>
        Order GetByOrderNumberAndConsumeUser(string orderNumber, string consumeUserName);

        /// <summary>
        /// 根据OrderNumber 和serviceUserName(服务用户名) 获取数据订单数据
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="serviceUserName"></param>
        /// <returns></returns>
        Order GetByOrderNumberAndServiceUser(string orderNumber, string serviceUserName);

        /// <summary>
        /// 根（消费用户名） 及status 获取结果orderNumber
        /// </summary>
        /// <param name="orderUser"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByConsumeUserAndStatus(string consumeUser, OrderStatus status);

        /// <summary>
        /// 根(服务者用户名) 及status 获取结果orderNumber
        /// </summary>
        /// <param name="orderUser"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        List<string> FindOrderNumbersByServiceUserAndStatus(string serviceUser, OrderStatus status);

        /// <summary>
        /// 根据OrderNumbers 及分页参数获取数据
        /// </summary>
        /// <param name="orderNumbers"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        ICollection<Order> GetByOrderNumbers(List<string> orderNumbers, int pageIndex, int pageSize);

        /// <summary>
        /// 作为服务者更新状态
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="serviceStatus"></param>
        /// <returns></returns>
        [Obsolete("此方法已经废弃", true)]
        Order UpdateServiceStatus(string orderNumber, string serviceUserName, OrderStatus orderStatus);

        /// <summary>
        /// 作为消费者更新状态
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="consumeUserName"></param>
        /// <returns></returns>
        [Obsolete("此方法已经废弃", true)]
        Order UpdateConsumeStatus(string orderNumber, string consumeUserName, OrderStatus orderStatus);

        /// <summary>
        /// 服务者取消订单
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="serviceUserName"></param>
        /// <returns></returns>
        Order CancelOrderAsService(string orderNumber, string serviceUserName);

        /// <summary>
        /// 消费者取消订单
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="consumeUserName"></param>
        /// <returns></returns>
        Order CancelOrderAsConsume(string orderNumber, string consumeUserName);

        /// <summary>
        /// 服务者取消订单
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="consumeUserName"></param>
        /// <returns></returns>
        Order ConfirmOrderAsService(string orderNumber, string serviceUserName, DateTime confirmStartDate, DateTime confirmEndDate);


        /// <summary>
        /// 消费者确认订单
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <param name="consumeUserName"></param>
        /// <returns></returns>
        Order ConfirmOrderAsConsume(string orderNumber, string consumeUserName);

        /// <summary>
        /// 根据提供的(订单编号 或 输入合作标题 或者合作者用户名)和消费用户获取数据 获取OrderNumbers
        /// </summary>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        List<string> FindByConsumeUserAndSearchValue(string consumeUser, string searchValue);

        /// <summary>
        /// 根据提供的(订单编号 或 输入合作标题 或者合作者用户名)和服务用户获取数据获取OrderNumbers
        /// </summary>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        List<string> FindByServiceUserAndSearchValue(string serviceUser, string searchValue);

        /// <summary>
        /// 创建订单
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        CreateOrderResponseDTO CreateOrder(Order order);

        /// <summary>
        /// 根据订单编号获取订单
        /// </summary>
        /// <param name="orderNumber"></param>
        /// <returns></returns>
        Order GetDataByOrderNumber(string orderNumber);


    }
}
